<?php
/* SVN FILE: $Id: skills_controller.php 250 2010-06-17 10:55:41Z gregory.rome $ */
/**
 * Skills Controller.
 *
 * Skills are for internal usage only.
 *
 * cBBweb : Digital Blood Bowl league interface (http://code.google.com/p/cbbweb/)
 * Copyright 2009-2010, Grégory Romé.
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright     Copyright 2009-2010, Grégory Romé.
 * @link          http://code.google.com/p/cbbweb/ cBBweb Project
 * @package       cbbweb
 * @subpackage    cbbweb.controllers
 * @version       $Revision: 250 $
 * @modifiedby    $LastChangedBy: gregory.rome $
 * @lastmodified  $Date: 2010-06-17 10:55:41 +0000 (Thu, 17 Jun 2010) $
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
 */

/**
 * Skills Controller.
 *
 * @package       cbbweb
 * @subpackage    cbbweb.controllers
 */
class SkillsController extends AppController {

	var $name = 'Skills';

	var $paginate = array (
        'limit' => 32,
	    'order' => array('SkillCategory.id' => 'asc'),
        'contain' => array(
            'LocalizedString',
            'FormattedString',
            'SkillCategory' => array ('LocalizedString')
	)   );

	function index() {
		$this->set('skills', $this->paginate());
	}

	function view($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Invalid Skill.', true));
			$this->redirect(array('action'=>'index'));
		}

		$skill = $this->Skill->find('all', array(
		  'conditions' => array('Skill.id' => $id),
		  'contain' => array(
		      'LocalizedString',
		      'FormattedString',
		      'SkillCategory' => array ('LocalizedString')
		) )	);

		$this->set('skill', $skill[0]);
	}

}
?>
